document.addEventListener('DOMContentLoaded', function() {
    fetch('/list')
        .then(response => response.json())
        .then(users => {
            if (users.length > 0) {
                const rowsHtml = users.map(user => {
                    const updateTime = user.updateTime ? user.updateTime.replace('T', ' ') : '';
                    return `
                        <tr>
                            <td>${user.id}</td>
                            <td>${user.username}</td>
                            <td>******</td>
                            <td>${user.name}</td>
                            <td>${user.age}</td>
                            <td>${updateTime}</td>
                        </tr>
                    `;
                }).join('');
                document.querySelector('.user-table tbody').innerHTML = rowsHtml;
            }
        });
});
